class Election < ActiveRecord::Base
  belongs_to :event
  has_many :votes
  @@children = []
  
  def self.inherited(sub)
    @@children << sub
  end
  
  def self.children
    return @@children
  end 

  def open?
    right_now = Time.now
    return true if right_now >= self.start_time && right_now <= self.end_time
    return false
  end
end
